#g++ -c -I./ field.cpp sudoku.cpp random.cpp main.cpp;
#g++ -c -I./ field.cpp sudoku.cpp random.cpp main.cpp; g++ -o main field.o sudoku.o random.o main.o;
# clear; g++ -c -I./ field.cpp sudoku.cpp random.cpp main.cpp; g++ -o main field.o sudoku.o random.o main.o; ./main > out
# 

# I am a comment, and I want to say that the variable CC will be
# the compiler to use.
CC=g++
# Hey!, I am comment number 2. I want to say that CFLAGS will be the
# options I'll pass to the compiler.
CFLAGS=-c -Wall

all: main

main: field.o sudoku.o random.o
	$(CC) field.o sudoku.o random.o -o main

field.o: field.cpp
	$(CC) $(CFLAGS) field.cpp

sudoku.o: sudoku.cpp
	$(CC) $(CFLAGS) sudoku.cpp

random.o: random.cpp
	$(CC) $(CFLAGS) random.cpp

clean:
	rm -rf *o main

# ----------------------------------------------------------------

IDIR =./
CC=g++
CFLAGS=-I$(IDIR)

ODIR=./
#LDIR =../lib

#LIBS=-lm

_DEPS = field.hpp sudoku.hpp random.hpp
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))

_OBJ = main.o field.o sudoku.o random.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))

$(ODIR)/%.o: %.c $(DEPS)
	$(CC) -c -o $@ $< $(CFLAGS)

field: $(OBJ)
	gcc -o $@ $^ $(CFLAGS) $(LIBS)

sudoku: $(OBJ)
	gcc -o $@ $^ $(CFLAGS) $(LIBS)

random: $(OBJ)
	gcc -o $@ $^ $(CFLAGS) $(LIBS)

main: $(OBJ)
	gcc -o $@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
	rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~ 

